public class Test06 {
    public static void main(String[] args) {
        Thread t = new Thread(() -> {
            for (int i = 0; i < 10; i++) {
                System.out.println(Thread.currentThread().getName() + "在执行");
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    throw new RuntimeException(e);
                }
            }
            System.out.println(Thread.currentThread() + "即将死去");
        }, "自己定义的线程");
        System.out.println(Thread.currentThread().getName() + ":ID" + t.getId());
        System.out.println(Thread.currentThread().getName() + ":名称" + t.getName());
        System.out.println(Thread.currentThread().getName() + ":状态" + t.getState());
        System.out.println(Thread.currentThread().getName() + ":优先级" + t.getPriority());
        System.out.println(Thread.currentThread().getName() + ":后台线程" + t.isDaemon());
        System.out.println(Thread.currentThread().getName() + ":活着" + t.isAlive());
        System.out.println(Thread.currentThread().getName() + ":被中断" + t.isInterrupted());

        t.start();
//        while (t.isAlive()) {
//            System.out.println(Thread.currentThread().getName() + ":状态" + t.getState());
//        }
    }
}
